/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package isratrzabality.uilayer;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Israel Ruiz
 */
public class TrazabilityTableModel extends AbstractTableModel{

    private String[] columnNames = {"Id","Nombre","Referecia padre"};
    private String[][] data = {{"","",""}
                               };
    
    public TrazabilityTableModel(String[][] data){
        this.data = data != null ? data:this.data;
    }
    
    public TrazabilityTableModel getTrazTableModel(){
       return this;
    }
    
    public void setData (String[][] setData){
        this.data = setData;
    }
    
    
    @Override 
    public int getRowCount() {
        return data.length;
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return data!= null ? data[rowIndex][columnIndex]:null;
    }
    
    @Override
    public String getColumnName(int col) {
        return columnNames[col];
    }
    
}
